<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
  <head> 
    <title>信息发布记录</title>  
    <jsp:include page="/include.jsp"/>
    <script type="text/javascript">
    //详细
    function doDetail(id){
    	window.top.$('<div/>').dialog({
			href:'${pageContext.request.contextPath}/infopublish/infoPublishAction!getPublishInfo.action?informationId='+id,
			top:($(window).height()-350)*0.5,
			left:($(window).width()-600)*0.5,  
			width:780,
			modal:true,
			title:'发布详细信息',	
			buttons:[{
				text:'关 闭',
				iconCls:'',  
				handler:function(){
					var d=window.top.$(this).closest('.window-body');
					d.dialog('destroy'); 
				}
			}],
			onClose:function(){
				window.top.$(this).dialog('destroy');
			}
		});
    }
    //执行查询
    function doQuery(){   
    	var dataGridOptions=$('#table_datagrid').datagrid('options');
		dataGridOptions.queryParams=serializeObject($('#query_form'));
		$('#table_datagrid').datagrid(dataGridOptions);  
		$('#table_datagrid').datagrid('load');
    }
 
    //重置查询条件
    function doReset(){
    	$('#query_form').form('reset');
    	$('#informationType').combobox('setValue',null);
    	$('#informationWay').combobox('setValue',null);
    }
    //页面加载完后响应 onReady
	$(function() {
	//	doQuery();
		//初始化主列表
		$('#table_datagrid').datagrid({
			url:'${pageContext.request.contextPath}/infopublish/infoPublishAction!getAllInfoPublishForPage.action',
			queryParams:serializeObject($('#query_form')),
			fit:true,
			border:false,
			fitColumns:true,
			striped:true,
			pagination:true,
			pageList:[10,20,30],
			rownumbers:false,
			singleSelect:true,                   
			/*sortName:'id',*/
			/* pagePosition:'both', */
			columns:[[{
				field:'title',
				title:'发布主题',
				width:150,
				align:'left',
				formatter:function(title,rowData,rowIndex){
						return '<div  onmouseover="onMouseOverName(this)"  onmouseout="onMouseOutName(this)" onclick="doDetail('+rowData.informationId+')" style="color:#2b76b7;cursor:pointer;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="'+title+'">'+title+'</div>';
				}
			},{
				field:'subscriberName',
				title:'订阅人',
				width:150,
				align:'center'
			},{
				field:'infomationWayName',
				title:'订阅方式',
				width:150,
				align:'center'
			},{ 
				field:'informationTypeName',
				title:'订阅类型',
				width:150,
				align:'center'
			   },{ 
				field:'publishedTime',
				title:'发布时间',
				width:150,
				align:'center', 
				sortable:true 
			}]],
		}); 
	
		//查询按纽绑定事件
		$('#btnQuery').bind('click',doQuery);
		//重置按纽绑定事件
		$('#btnReset').bind('click',doReset);
		
// 		//初始化下拉树
// 		$('#subscriber').combotree({  
// 		    url: '${pageContext.request.contextPath}/infopublish/infoPublishAction!getUserTreeInfo.action',  
// 		    parentField : 'pid',
// 		    required: false,
// 		    onSelect:function(node){
// 		    	var obj=node.id.split("@@");
// 		    	if(obj[1]!="parent"){
// 		    		$('#subscriber').val(obj[0]);
// 		    	}else{
// 		    		$('#subscriber').combotree('clear');
// 		    	}
// 	        }
// 		}); 
		     //   delay: 500,
			//	panelWidth:450,
			//	mode: 'remote',   
			//	url: '${pageContext.request.contextPath}/mininganalysis/dataImportAction!getAllKqiName.action',   
			//	idField: 'kqiid',   
			//	textField: 'kqiname',  
		    //    pagination : true,//是否分页  
		   //     rownumbers:true,//序号  
		  //      collapsible:false,//是否可折叠的  
		 //       fit: true,//自动大小  
		//        fitColumns:true,  
		//初始化下拉列表 
		$('#subscriber').combogrid({
			delay: 500,
	        panelWidth:450,  
	        idField:'userid', //ID字段  
	        textField:'username', //显示的字段  
	        mode: 'remote',   
	        url:"${pageContext.request.contextPath}/problemmgr/problemAction!showHandler.action",  
	        fitColumns: true,  
	        striped: true,  
	        editable:false,
	        pagination : true,//是否分页  
	        rownumbers:true,//序号  
	        collapsible:false,//是否可折叠的  
	        fit: true,//自动大小  
	        pageSize: 10,//每页显示的记录条数，默认为10  
	        pageList:[10,20,30],//可以设置每页记录条数的列表  
	        method:'post',  
	        columns:[[{field:'userid',title:'用户ID',width:70,align:'center',sortable:true},				  
					  {field:'username',title:'用户名称',width:75,align:'center',sortable:true}		 
					]],
			toolbar:'#tb'
	    }); 
		
		//初始化订阅方式下拉框
		$('#informationWay').combobox({  
		    url:'${pageContext.request.contextPath}/infopublish/infoPublishAction!getDictionaryInfo.action?codeType=subscribeMode&tableName=TD_SUBSCRIBLE_DEFINE',  
		    valueField:'codeValue',
			textField:'codeName',
			panelHeight:'auto',
  	 		editable:false,
  	 		onLoadSuccess:function(){
  				$('#informationWay').combobox('setValue',null);
  			}
		});  
		
		//初始化发布类型下拉框
		$('#informationType').combobox({  
		    url:'${pageContext.request.contextPath}/infopublish/infoPublishAction!getDictionaryInfo.action?codeType=reportType&tableName=TD_SPEED_REPORT_DEFINE',  
		    valueField:'codeValue',
			textField:'codeName',
			panelHeight:'auto',
  	 		editable:false,
  	 		onLoadSuccess:function(){
  				$('#informationType').combobox('setValue',null);
  			}
		}); 
		
		$('#publishedTime').my97({
			dateFmt:'yyyy-MM-dd',
			startDate:[{
				doubleCalendar:false,
				isShowWeek:false,
				isShowClear:false,
				readOnly:true
			}]
		});
	});
    
	function queryUser()
  	{
   		var username=$('#query_userName').val();	
   		var query={username:username}; //把查询条件拼接成JSON
   		var grid=$("#subscriber").combogrid('grid');  
   		$(grid).datagrid('options').queryParams=query; //把查询条件赋值给datagrid内部变量
   		$(grid).datagrid('load');
   	}

	function resetQuery()
  	{
		$('#query_userName').val('');
   	}
	  
</script>
<body class="easyui-layout">  
	<form id="query_form" method="post">
	   <div data-options="region:'north'" style="height:80px;border-bottom:none;border-top:none;padding-top:3px">
	    	<table border="0" cellpadding="0" cellspacing="0" height="100%"  width="100%" >
	    		<tr>
		    		<td style="text-align:right;width:10%;" nowrap="nowrap">
						<label>订阅人：&nbsp;</label>
					</td>
					<td style="text-align:left;width:15%;" nowrap="nowrap">
	    				<input type="text" id="subscriber" style="height:22px;"  name="subscriber" />
					</td>
					<td style="text-align:right;width:10%;" nowrap="nowrap">
						<label>发布方式：&nbsp;</label>
					</td>
					<td style="text-align:left;width:15%;" nowrap="nowrap">
	    				<input id="informationWay" class="easyui-combobox"  name="informationWay" />
					</td>
					<td style="text-align:right;width:10%;" nowrap="nowrap">
						<label>发布时间：&nbsp;</label>
					</td>
					<td style="text-align:left;width:15%;" nowrap="nowrap">
	    				<input id="publishedTime"  type="date"  name="publishedTime" />
					</td>
					<td style="text-align:right;width:10%;" nowrap="nowrap">
						<label> 发布类型：&nbsp;</label>
					</td>
					<td style="text-align:left;width:15%;padding-right:35px;" nowrap="nowrap">
	    				<input id="informationType" class="easyui-combobox"  name="informationType" />
					</td>
	    		</tr>
	    		<tr>
	    			<td style="text-align:right;width:10%;" nowrap="nowrap">
						<label> 发布主题：&nbsp;</label>
					</td>
					<td style="text-align:left;width:15%;" nowrap="nowrap">
	    				<input type="text" id="title" class="easyui-validatebox" name="title" validType="specialCharFilter('title')"/>  
					</td>
					<td style="width:10%;text-align:right;" nowrap="nowrap">
					</td>
					<td style="width:15%;text-align:left;" nowrap="nowrap">
					</td>
					<td style="width:10%;text-align:right;" nowrap="nowrap">
					</td>
					<td style="width:15%;text-align:left;" nowrap="nowrap">
					</td>
					<td colspan="2" style="width:25%;text-align:right;" nowrap="nowrap">	   
			    		<input type="button" id="btnQuery" name="" value="查 询" style="cursor:pointer;background-image: url('${pageContext.request.contextPath}/images/login/search.png');background-repeat: no-repeat;width:67px;height:23px;padding-left:12px;border:none;color:white;font-family:微软雅黑"/>	
			    		<input type="button" id="btnReset" name="" value="重 置" style="cursor:pointer;background-image: url('${pageContext.request.contextPath}/images/login/reset.png');background-repeat: no-repeat;width:67px;height:23px;padding-left:12px;border:none;color:white;font-family:微软雅黑;margin-right:35px"/>				
	    			</td>
	    		</tr>
			</table>
	    </div>   
		<div id="tb" style="padding:5px;height:auto">   
		    <div>  
		               用户名称 : <input id="query_userName" type="text" class="easyui-validatebox" style="width:150px" >  
		        <input type="button" id="btnQuery" onclick="queryUser()" value="查 询" style="cursor:pointer;background-image: url('${pageContext.request.contextPath}/images/login/search.png');background-repeat: no-repeat;width:67px;height:23px;padding-left:12px;border:none;color:white;font-family:微软雅黑;"/>	
				<input type="button" id="btnReset" onclick="resetQuery()" value="重 置" style="cursor:pointer;background-image: url('${pageContext.request.contextPath}/images/login/reset.png');background-repeat: no-repeat;width:67px;height:23px;padding-left:12px;border:none;color:white;font-family:微软雅黑;margin-right:55px"/> 
		    </div>  
		</div>
	    <div data-options="region:'center'">  
	        <table id="table_datagrid"> 
			</table>
	    </div>  
    </form>
</body>  
</html>